<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<script type="text/javascript">
function setRelVal(obj){
	var value = obj.value;
	if(value.lastIndexOf(".")>=0){
		value = value.substring(0,value.lastIndexOf("."));
	}
	$("#"+"${empty menuId ? "add":"edit" }"+"_menuRel").val(value);
}
</script>
<div class="pageContent">
	<form action="menuAuth_${empty menuId ? "
		add":"edit" }.action"
		class="pageForm required-validate"
		onsubmit="return validateCallback(this, menuDialogAjaxDone);"
		method="post">
		<input type="hidden" name="menuId" value="${menuId }">
		<div class="pageFormContent nowrap" layoutH="56">
			<dl>
				<dt>
					<label>系统名称：</label>
				</dt>
				<dd>
					<c:choose>
						<c:when test="${empty menuId}">
							<input value="${sysDict.dicName}" readonly="true">
							<input type="hidden" name="sysNameDc" value="${sysNameDc}">
							<!-- 
							<select name="sysNameDc" 
								class="required combox"
								ref="add_menuList"
								refUrl="menuAuth_getMenusBySys.action?sysNameDc={value}">
								<option value="">---请选择---</option>
								<c:forEach items="${systemDictList}" var="systemDic">
									<option ${sysNameDc==systemDic.dicCode?"selected":""}  value="${systemDic.dicCode }">${systemDic.dicName}</option>
								</c:forEach>
							</select>
							 -->
						</c:when>
						<c:otherwise>
							<input value="${sysDict.dicName}" readonly="true">
						</c:otherwise>
					</c:choose>
				
				</dd>
			</dl>
			<dl>
				<dt>
					<label>上级菜单：</label>
				</dt>
				<dd>
					<select name="parentId" class="combox"
						id="${empty menuId ? "add":"edit" }_menuList">
						<option value="">---请选择---</option>
						 <%--处理回显  --%>
						<c:choose>
							<c:when test="${empty menuId}">
								<!-- 新增 -->
								<c:forEach items="${allMenuBySys}" var="menu">
									<option ${parentId == menu.menuId?"selected":"" }  value="${menu.menuId}">${menu.menuName}</option>
								</c:forEach>
							</c:when>
							<c:otherwise>
								<!-- 修改 -->
								<c:forEach items="${allMenuBySys}" var="menu">
									<option ${parent.menuId == menu.menuId?"selected":"" }  value="${menu.menuId}">${menu.menuName}</option>
								</c:forEach>
							</c:otherwise>
						</c:choose>
					</select>
				</dd>
			</dl>
			<dl>
				<dt>
					<label>菜单类型：</label>
				</dt>
				<dd>
					<select name="menuType" class="required combox">
						<option value="">---请选择---</option>
						<option ${menuType==1?"selected":"" } value="1">主菜单</option>
						<option ${menuType==0?"selected":"" } value="0">超链接</option>
					</select>
				</dd>
			</dl>
			
			<dl>
				<dt>
					<label>菜单名称：</label>
				</dt>
				<dd>
					<input name=menuName class="required" type="text"
						maxlength="20" value="${menuName}" />
				</dd>

			</dl>
			<dl>
				<dt>
					<label>菜单URL：</label>
				</dt>
				<dd>
					<input name=menuUrl type="text" onblur="setRelVal(this)"
						maxlength="200" value="${menuUrl}" />
				</dd>
			</dl>
			<dl>
				<dt>
					<label>Target：</label>
				</dt>
				<dd>
					<select name="menuTarget" class="combox">
						<option value="">---请选择---</option>
						<option ${menuTarget=="navTab"?"selected":"" } value="navTab">navTab</option>
						<option ${menuTarget=="dialog"?"selected":"" } value="dialog">dialog</option>
						<option ${menuTarget=="ajaxTodo"?"selected":"" } value="ajaxTodo">ajaxTodo</option>
						<option ${menuTarget=="_blank"?"selected":"" } value="ajaxTodo">_blank</option>
					</select>
				</dd>
			</dl>
			<dl>
				<dt>
					<label>Rel：</label>
				</dt>
				<dd>
					<input id="${empty menuId ? "add":"edit" }_menuRel" name=menuRel  type="text"
						maxlength="60" value="${menuRel}" />
				</dd>
			</dl>
			<!-- 
			<dl>
				<dt>
					<label>菜单样式：</label>
				</dt>
				<dd>
					<input name=menuCSS  type="text"
						maxlength="20" value="${menuCSS}" />
				</dd>
			</dl>
			<dl>
				<dt>
					<label>图标：</label>
				</dt>
				<dd>
				</dd>
			</dl>
			 -->
			<dl>
				<dt>
					<label>排序代码：</label>
				</dt>
				<dd>
					<input type="text" min="1000" max="9999" class="required digits" name="menuOrder" value="${menuOrder}" />
				</dd>
			</dl>
			<dl>
				<dt>
					<label>菜单描述：</label>
				</dt>
				<dd>
					<textarea name="menuDesc" rows="2" cols="30" maxlength="200">${menuDesc}</textarea>
				</dd>
			</dl>

		</div>
		<div class="formBar">
			<ul>
				<li><div class="buttonActive">
						<div class="buttonContent">
							<button type="submit">保存</button>
						</div>
					</div></li>
				<li>
					<div class="button">
						<div class="buttonContent">
							<button type="button" class="close">取消</button>
						</div>
					</div>
				</li>
			</ul>
		</div>
	</form>
</div>